atomic-css major refactor! Please Review. Fixes #17 #21
+2,945
−2,793
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #20 - I have completely rewritten this library. It is now focused exclusively on implementing Atomic CSS. The "View" type with its ViewId reader context will be moved to hyperbole. This library could now be used with Blaze or another html combinator library if desired.
@kfigiela @Skyfold @benjaminweb @benjamin-thomas @tusharad - please review if you can!
New library:
atomic-css
This libary will be named "atomic-css" instead of "web-view". The old package will be deprecated. There will be a Web.Hyperbole.View that builds on this libary to add the features it needs.
This will be explicity opt-in for Hyperbole. I changed my mind about ease-of-use. I think it will help to inform users that this functionality comes from this package.
New Interface
Instead of tags requiring a "Mod" argument, we have implemented two operators in the style of Blaze's
(!)
. Attributes are applied with@
, and Utility classes are applied with~
.This is what it used to be:
These are completely separate, so while you can compose attributes with each other, you can't compose an attribute and a utility:
Built-in Html Monad
This library includes an
Html
monad, which makes this a functional rendering library. It does not export any HTML tag functions, leaving this to downstream libraries.Override Styles, Fixes #17
CSS now automatically overrides any previously applied utilities that affect the same property. If you create a "component" that sets some styles, you can easily override anything without worrying about precedence:
Easy Custom CSS
I started down this path after becoming annoyed at the difficulty writing css-only tooltips. These required custom selectors. The previous interface was confusing. Now, you can create custom css rules, and these will not be modified by
hover
, etc. The example below predicatably adds a "tooltips" class to the the parent, and shows the ".tooltip" child when you hover over anything inside it.It's also much easier to define your own utilities if any are missing or you need something custom: